// house_pkg/pages/room/index.ts
Page({
  data: {
    point: "",
    building: '',
    room: []
  },
  /**
    * 生命周期函数--监听页面加载
    */
  onLoad({ point, building }) {
    // console.log(point, building);
    const room = []
    for (let index = 0; index < 6; index++) {
      room.push(`${this.getRandom(1, 10)}${this.getRandom(1, 10)}${this.getRandom(1, 10)}`)
    }

    //数组排序
    room.sort((a, b) => {
      //转数字
      a = + a
      b = + b
      //升序
      return a - b > 0 ? 1 : -1
    })

    //设置data数据
    this.setData({
      point,
      building,
      room
    })
  },
  // 获取一定范围内的随机整数
  getRandom(min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min
  },
})